cmake_minimum_required(VERSION 3.8)
project(topic_01)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

add_executable(publisher_01 src/publisher_01.cpp)
ament_target_dependencies(publisher_01 rclcpp std_msgs)

add_executable(subscription_01 src/subscription_01.cpp)
ament_target_dependencies(subscription_01 rclcpp std_msgs)

add_executable(publisher_queue src/publisher_queue.cpp)
ament_target_dependencies(publisher_queue rclcpp std_msgs)

add_executable(subscription_queue src/subscription_queue.cpp)
ament_target_dependencies(subscription_queue rclcpp std_msgs)

add_executable(sub_wait_for_message src/sub_wait_for_message.cpp)
ament_target_dependencies(sub_wait_for_message rclcpp std_msgs)

add_executable(publish_once_data_node_exec src/publish_once_data_node.cpp)
ament_target_dependencies(publish_once_data_node_exec rclcpp std_msgs)

add_executable(subscriper_once_data_node_exec src/subscriper_once_data_node.cpp)
ament_target_dependencies(subscriper_once_data_node_exec rclcpp std_msgs)

add_executable(publish_loop_data_node_exec src/publish_loop_data_node.cpp)
ament_target_dependencies(publish_loop_data_node_exec rclcpp std_msgs)

install(TARGETS 
       publisher_01
       subscription_01
       publisher_queue
       subscription_queue
       sub_wait_for_message
       publish_once_data_node_exec
       subscriper_once_data_node_exec
       publish_loop_data_node_exec
       DESTINATION lib/${PROJECT_NAME})

install(DIRECTORY 
  launch
  DESTINATION share/${PROJECT_NAME})

ament_package()
